<template>
  <div>
      <div class="container">
          <el-breadcrumb separator="/">
              <el-breadcrumb-item class="mg">
                  评价管理
              </el-breadcrumb-item>
          </el-breadcrumb>
          <div class="handle-box">
              <span>用户名：</span><el-input v-model="query.name" placeholder="用户名称" class="handle-input mr10"></el-input>
              <span>手机号：</span><el-input v-model="query.phone" placeholder="手机号" class="handle-input mr10"></el-input>
              <span>注册时间：</span>
              <el-date-picker
                  v-model="value1"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期">
              </el-date-picker>
              <p class="mt">
                  <span>评价星级：</span>
                  <el-select v-model="value" placeholder="请选择"                     class="mr30">
                      <el-option
                      v-for="item in options"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                      </el-option>
                  </el-select>
                  <el-button type="primary" @click="handleSearch">筛选</el-button>
                  <el-button type="text" @click="handleSearch">清空筛选条件</el-button>
              </p>
          </div>
          <el-table
              :data="tableData"
              border
              class="table"
              ref="multipleTable"
              header-cell-class-name="table-header"
          >
              <el-table-column prop="id" label="订单编号" align="center"></el-table-column>
              <el-table-column prop="serviceItem" label="服务内容" align="center"></el-table-column>
              <el-table-column prop="commentContent" label="评价者" align="center"></el-table-column>
              <el-table-column prop="star" label="星级" align="center"></el-table-column>
              <el-table-column prop="picture" label="图片" align="center"></el-table-column>
              <el-table-column prop="commentContent" label="评价内容" align="center"></el-table-column>
              <el-table-column prop="createdDate" label="评价时间" align="center"></el-table-column>
          </el-table>
          <div class="pagination">
              <el-pagination
                  background
                  layout="total, prev, pager, next"
                  :current-page="query.pageIndex"
                  :page-size="query.pageSize"
                  :total="pageTotal"
                  @current-change="handlePageChange"
              ></el-pagination>
          </div>
      </div>
  </div>
</template>

<script>
import { detail } from '../../../api/index';
export default {
  name: 'basetable',
  data() {
      return {
          value1:'',
          options: [{
              value: '选项1',
              label: '一星'
          }, {
              value: '选项2',
              label: '双皮奶'
          }, {
              value: '选项3',
              label: '蚵仔煎'
          }, {
              value: '选项4',
              label: '龙须面'
          }, {
              value: '选项5',
              label: '北京烤鸭'
          }],
      value: '',
          query: {
              address: '',
              name: '',
              pageIndex: 1,
              pageSize: 10,
              phone:'',
          },
          tableData: [],
          pageTotal: 0,
      };
  },
  created() {
      this.getData();
  },
  methods: {
      // 获取 easy-mock 的模拟数据
      getData() {
        detail().then(res => {
              console.log(res);
              this.tableData = res.data.list;
              this.pageTotal = res.pageTotal || 50;
          });
      },
      // 触发搜索按钮
      handleSearch() {
          this.$set(this.query, 'pageIndex', 1);
          this.getData();
      },
      // 详情操作
      handlePageChange(val) {
          this.$set(this.query, 'pageIndex', val);
          this.getData();
      }
  }
};
</script>

<style scoped>
.handle-box {
  margin-bottom: 60px;
  background-color: rgb(245,245,245);
  padding: 20px 40px;
}
.handle-select {
  width: 120px;
}
>>>.el-table tbody tr{
  height: 100px;
}
.mg{
  margin: 20px 0;
}
.handle-input {
  width: 250px;
  display: inline-block;
}
.table {
  width: 100%;
  font-size: 14px;
}
.red {
  color: #ff0000;
}
.mr10 {
  margin-right: 10px;
}
.mr30{
  margin-right: 50px;
}
.mt{
  margin-top: 20px;
}
.table-td-thumb {
  display: block;
  margin: auto;
  width: 40px;
  height: 40px;
}
</style>
